package Demo01;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28463
 * Date: 2022—05—16
 * Time: 12:58
 */
class Shape {

    public void draw(){
        System.out.println("画图形！");
    }
}
class Rect extends Shape{
    @Override
    public void draw() {
        System.out.println("♦");
    }
}
class Cycle extends Shape{
    @Override
    public void draw() {
        System.out.println("●");
    }
}
class Triangle extends Shape {
    @Override
    public void draw() {
        System.out.println("△");
    }
}
public class Test02 {
    public static void drawMap(Shape shape) {
        shape.draw();
    }
    public static void main(String[] args) {
        Rect rect = new Rect();
        Cycle cycle =new Cycle();
        Triangle triangle = new Triangle();
        drawMap(rect);
        drawMap(cycle);
        drawMap(triangle);
    }
}
